//created by: Justina Lee

Ext.define("MajorProjectSenchaTouch.view.EResourcesModule.EResources", {
    extend: 'Ext.Panel',
    xtype: 'eResourcescard',
    id: 'eRCard',
    requires:[
    'MajorProjectSenchaTouch.view.EResourcesModule.EResourcesList',
    'MajorProjectSenchaTouch.store.EResourcesCategories',
	'MajorProjectSenchaTouch.view.EResourcesModule.EBooksSearch',
    'Ext.form.FieldSet',
    'Ext.field.Select'
    ],
    config: {
        cls:'mainBackgroundColor',
        iconCls: 'doc_drawer',
        title: 'eResources',
        layout:{
            fullscreen: true,
            type:'fit'
        },
        items:[
        {
            xtype:'panel',
            docked: 'top',
			layout: {
				fullscreen: true
			},
            items:[
            //used selectfield's picker for filter'
            {
                xtype: 'selectfield',
                id:'filterSelectField',
                hidden: true,
                usePicker: true,
                field: 'Filter',
                store: 'EResourcesCategories',
                displayField: 'name',
                valueField: 'name'
            },
            {
                xtype:'toolbar',
                ui: 'light',
                docked: 'top',
                items:[
                {
                    xtype:'spacer'  
                },                
                //filter button
                {
                    xtype: 'selectfield',
					name: 'type',
                    ui: 'light',
					centered: true,
					width: '60%',
					// right: '0.1em',
                    usePicker: true,
                    id: 'eResourcesFilter',
                    cls: 'advaSelectFieldSty',
                    options: [
                    {
                        text: 'Jump To: All',
                        value: 'All'
                    },
                    {
                        text: 'Jump To: Journal & Magazine Articles',
                        value: 'Journal & Magazine Articles'
                    },
                    {
                        text: 'Jump To: Newspaper',
                        value: 'Newspaper'
                    },
                    {
                        text: 'Jump To: Reports & Statistics',
                        value: 'Reports & Statistics'
                    },
					{
                        text: 'Jump To: Specialist Resources',
                        value: 'Specialist Resources'
                    }],
					listeners:{
						change: function(selectfield, value, oldValue){
							var searchController = MajorProjectSenchaTouch.app.getController('EResources');
							searchController.filterCategory(selectfield, value, oldValue);
						}
					}
                }
                ]
            }
			// ,{
				// xtype:'basicebooksfilter'
			// }
            ]
        },		
        {
            xtype: 'eResourcesList'
        }
        ]
    }
});